<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
        <div class="layui-form-item">
            <label class="layui-form-label">优惠券类型</label>
            <div class="layui-input-block">
                <input type="radio" name="type" lay-filter="selectTypeList" value="0" title="普通券" {if condition="$row.type eq 0"}checked{/if}>
                <input type="radio" name="type" lay-filter="selectTypeList" value="1" title="满减券" {if condition="$row.type eq 1"}checked{/if}>
            </div>
        </div>
        <div class="layui-form-item money" {if condition="$row.type eq 0"}style="display: none"{/if}>
            <label class="layui-form-label">满减额</label>
            <div class="layui-input-block">
                <input type="number" name="money" class="layui-input"
                       placeholder="订单满足 金额才可以使用"
                       value="{$row.money|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">优惠券名称</label>
            <div class="layui-input-block">
                <input type="text" name="title" class="layui-input" lay-verify="required" placeholder="请输入优惠券名称"
                       value="{$row.title|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">面额</label>
            <div class="layui-input-block">
                <input type="number" name="face_val" class="layui-input" lay-verify="required"
                       placeholder="请输入面额 大于0 整数"
                       value="{$row.face_val|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">使用条件</label>
            <div class="layui-input-block">
                <input type="number" name="use_limit" class="layui-input" lay-verify="required"
                       placeholder="请输入条件 0不限制 其他限制金额"
                       value="{$row.use_limit|default='0'}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">使用说明</label>
            <div class="layui-input-block">
                <input type="text" name="use_desc" class="layui-input" lay-verify="required" placeholder="请输入使用说明"
                       value="{$row.use_desc|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">发放总数</label>
            <div class="layui-input-block">
                <input type="number" name="count" class="layui-input" lay-verify="required" placeholder="请输入条件 大于0 整数"
                       value="{$row.count|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">使用时间类型</label>
            <div class="layui-input-block">
                <input type="radio" name="use_time_type" lay-filter="selectType" value="1" title="时间限制" {if condition="$row.use_time_type eq 1"}checked{/if}>
                <input type="radio" name="use_time_type" lay-filter="selectType" value="2" title="天数限制" {if condition="$row.use_time_type eq 2"}checked{/if}>
            </div>
        </div>
        <div class="">
            <div class="layui-form-item">
                <label class="layui-form-label">领券开始时间</label>
                <div class="layui-input-block">
                    <input type="text" name="start_time" id="start_time" class="layui-input" lay-verify="" placeholder="请选择时间"
                           value="{$row.start_time|default=''|date='Y-m-d H:i:s'}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">领券结束时间</label>
                <div class="layui-input-block">
                    <input type="text" name="end_time" id="end_time" class="layui-input" lay-verify="" placeholder="请选择时间"
                           value="{$row.end_time|default=''|date='Y-m-d H:i:s'}">
                </div>
            </div>
            <div class="layui-form-item type_date" {if condition="$row.use_time_type eq 2"}style="display:none"{/if}>
                <label class="layui-form-label">用券结束时间</label>
                <div class="layui-input-block">
                    <input type="text" name="use_end_time" id="use_end_time" class="layui-input" lay-verify=""
                           placeholder="请选择时间"
                           value="{$row.use_end_time|default=''|date='Y-m-d H:i:s'}">
                </div>
            </div>
        </div>

        <div class="layui-form-item type_day"  {if condition="$row.use_time_type eq 1"}style="display:none"{/if}>
            <label class="layui-form-label">指定天数</label>
            <div class="layui-input-block">
                <input type="number" name="use_days" class="layui-input" lay-verify="required"
                       placeholder="请输入领取后几天失效"
                       value="{$row.use_days|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">每人限领</label>
            <div class="layui-input-block">
                <input type="number" name="receive_limit" class="layui-input" lay-verify="required"
                       placeholder="请输入限领 0为不限制 1限制次数"
                       value="{$row.receive_limit|default='0'}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">每人/天数量</label>
            <div class="layui-input-block">
                <input type="number" name="receive_day_limit" class="layui-input" lay-verify="required"
                       placeholder="请输入限领 0为不限制 1限制次数"
                       value="{$row.receive_day_limit|default='0'}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否新人专享</label>
            <div class="layui-input-block">
                <input type="checkbox" value="1" name="new_limit" lay-skin="switch" lay-text="新人专享|不限制新人" {if condition="$row.new_limit eq 1"}checked{/if}>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否分享领取</label>
            <div class="layui-input-block">
                <input type="checkbox" value="1" name="need_share" lay-skin="switch" lay-text="是|否" {if condition="$row.need_share eq 1"}checked{/if}>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">使用类型</label>
            <div class="layui-input-block">
                <select name="use_type" lay-verify="required">
                    <option value="">请选择</option>
                    <option value="1" {if condition="$row.use_type eq 1"}selected{/if}>全店商品</option>
                    <option value="2" {if condition="$row.use_type eq 2"}selected{/if}>指定商品</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item goods_list" {if condition="$row.use_type eq 1"}style="display: none"{/if}>
            <label class="layui-form-label">选择商品</label>
            <div class="layui-input-block">
                <div id="goods"></div>
            </div>
        </div>

        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<script type="text/javascript">
    let h_start_time = "{$row.start_time}";
    let h_end_time = "{$row.end_time}";
    let h_use_end_time = "{$row.use_end_time}";
    let goods_lists = "{$row.goods_list}";
</script>